from urllib.parse import urlparse


def url_path(url):
    parsed_url = urlparse(url)
    # 使用 split() 方法将路径分割成多个部分，然后使用切片获取我们需要的部分
    path_parts = parsed_url.path.split("/")[-1]
    return path_parts


def count_elements(arr):
    counts = {}
    for elem in arr:
        if elem in counts:
            counts[elem] += 1
        else:
            counts[elem] = 1
    return counts


def sp(str):
    string = str.strip().replace("\r", "").replace("\n", "").replace(" ", "").replace("\t", "")
    return string
